console.log('rdf4js :-) ');

rdf = function(s,p,o){
	this.id=function(){return Math.random().toString().split('.')[1]};
	this.spo=[];
	this.pos=[];
	this.osp=[];

	this.set=function(s,p,o,id){//x=[s,p,o]
		if (!p){// if tripples being submitted as an array of tripples through s
			if (typeof(s[0])!=='object'){s=[s]};//
			for (var i in s){
				this.set(s[i][0],s[i][1],s[i][2],s[i][3]);
			}
		}
		else {
			if (!id){id = this.id()}

			this.id[id]=[s,p,o];

			if (!this.spo[s]){this.spo[s]=[];this.spo[s][p]=[]}
			else {if (!this.spo[s][p]){this.spo[s][p]=[]}}
			this.spo[s][p][id]=o;
			
			if (!this.pos[p]){this.pos[p]=[];this.pos[p][o]=[]}
			else {if (!this.pos[p][o]){this.pos[p][o]=[]}}
			this.pos[p][o][id]=s;
			
			if (!this.osp[o]){this.osp[o]=[];this.osp[o][s]=[]}
			else {if (!this.osp[o][s]){this.osp[o][s]=[]}}
			this.osp[o][s][id]=p;
			
			//this.pos[p]=[];this.pos[p][o]=[s];
			//this.osp[o]=[];this.osp[o][s]=[p];
		}
		return false
	}
	this.get=function(s,p,o,id){
		if (id){
			var a = new rdf(this.id[id]);
			return a;
		}
	}
	if (s){// seed rdf
		this.set(s,p,o);
	}
	return false
}